Populist Parties and Persistent Non-Compliance with EU Law

Robert A. Huber, Thomas Lehner, and Carsten Wegscheider

1 How to proceed

Thank you for your interest in our replication materials. All steps required to replicate the results in R can be run from the file master_replication.R in the subfolder rcode. This file loads various individual scripts which provide descriptive figures and run the analyses.

2 Prepare Replication Data

After downloading our replication material, please open the file replication_material.Rproj. You need to have installed R (version 4.2x) and RStudio for this. After opening the .Rproj file in RStudio, please open the file master_replication.R within the project. This script can be found in the subfolder r_code. In the next steps, we describe each of the steps of the master_replication.R file.

3 Install/Load Packages

The following code installs all packages (if required). After that it loads the packages. The code then also uses the here package to set the working directory. Runtime of this code depends on the number of packages that you have already installed. However, even when you have no packages installed, it should only take a few minutes.

run_start_total <- Sys.time()
run_start <- Sys.time()

pkgs <- c("tidyverse",
          "effects",
          "ggthemes")

# Function to check if packages are installed
# If not: package will be installed from CRAN and then loaded
# If: Package will be loaed

install_load <- function(packages){
  
  for (p in packages) {
    cat("Check package: '", p, "'...\n", sep = "")
    flush.console()
    
    if (p %in% rownames(installed.packages())) {
      
      cat("Package: '", p, "' is already installed...\n\n", sep = "")
      flush.console()
      
      library(p, character.only=TRUE)
      
    } else {
      
      cat("Package: '", p, "' is NOT installed! Will install now...\n\n", sep = "")
      install.packages(p)
      library(p,character.only = TRUE)
      
    }
  }
  cat("\nAll packages installed!\n\n")
}

# Apply function to all required packages

install_load(pkgs)
## Check package: 'tidyverse'...
## Package: 'tidyverse' is already installed...
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
## Check package: 'effects'...
## Package: 'effects' is already installed...
## Lade nötiges Paket: carData
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
## Check package: 'ggthemes'...
## Package: 'ggthemes' is already installed...
## 
## 
## All packages installed!
# Set wd with here() package

here::i_am("README.Rmd")
## here() starts at C:/Users/b1040249/Dropbox (Privat)/Research/Populism and EU Law Compliance/replication_materials
run_stop <- Sys.time()
run_time <- (run_stop - run_start)
run_time
## Time difference of 4.561384 secs

4 Descriptive Evidence for Figure 10.1

The script descriptives_compliance in the subfolder rcode loads the underlying data, and replicates Figure_10.1 from our book chapter in the figures folder. .

run_start <- Sys.time()

source("rcode/descriptives_compliance.R", echo = T)
## 
## > df <- readRDS("data/compliance_data.rds")
## 
## > df_plot <- df %>% filter(df$MemberSince >= 1) %>% 
## +     dplyr::group_by(year) %>% dplyr::summarise(FN = mean(Formal_notice), 
## +     RO = mean(Reaso .... [TRUNCATED] 
## 
## > df_plot$dim <- factor(df_plot$dim, levels = c("FN", 
## +     "RO", "RC"))
## 
## > ggplot(df_plot, aes(x = year, y = value, color = dim)) + 
## +     geom_line(aes(linetype = dim)) + ggthemes::theme_tufte() + 
## +     labs(y = "Average  ..." ... [TRUNCATED]
## 
## > ggsave("figures/Figure_10_1.pdf", width = 16, height = 9, 
## +     units = "cm")
## 
## > ggsave("figures/Figure_10_1.png", width = 16, height = 9, 
## +     units = "cm")

run_stop <- Sys.time()
run_time <- (run_stop - run_start)
run_time
## Time difference of 2.696076 secs

5 Regression analysis creating Tables 10.1, 10.2, and 10.3

The script analyses_compliance in the subfolder rcode creates Table_10_1.tex, Table_10_2.tex, and Table_10_3.tex in the tables folder.

run_start <- Sys.time()

source("rcode/analyses_compliance.R", echo = T)
## 
## > iv0 <- c("+ Pop")
## 
## > iv1 <- c("+ Gov + Opp")
## 
## > iv2 <- c("+ R_Gov + R_Opp + C_Gov + C_Opp + L_Gov + L_Opp")
## 
## > iv2_PL <- c("+ R_Gov_PL + R_Opp_PL + C_Gov_PL + C_Opp_PL + L_Gov_PL + L_Opp_PL")
## 
## > controls <- c("+ worlds +  euroscepticism + year_A + I(year_A^2) + govLR")
## 
## > m0_1 <- lm(paste0("Formal_notice ~ L.FN", iv0, controls), 
## +     df, subset = MemberSince >= 1)
## 
## > m0_2 <- lm(paste0("Reason_opinions ~ L.RO", iv0, controls), 
## +     df, subset = MemberSince >= 1)
## 
## > m0_3 <- lm(paste0("referrals_to_court ~ L.RC", iv0, 
## +     controls), df, subset = MemberSince >= 1)
## 
## > m1_1 <- lm(paste0("Formal_notice ~ L.FN", iv1, controls), 
## +     df, subset = MemberSince >= 1)
## 
## > m1_2 <- lm(paste0("Reason_opinions ~ L.RO", iv1, controls), 
## +     df, subset = MemberSince >= 1)
## 
## > m1_3 <- lm(paste0("referrals_to_court ~ L.RC", iv1, 
## +     controls), df, subset = MemberSince >= 1)
## 
## > m2_1 <- lm(paste0("Formal_notice ~ L.FN", iv2, controls), 
## +     df, subset = MemberSince >= 1)
## 
## > m2_1_PL <- lm(paste0("Formal_notice ~ L.FN", iv2_PL, 
## +     controls), df, subset = MemberSince >= 1)
## 
## > m2_2 <- lm(paste0("Reason_opinions ~ L.RO", iv2, controls), 
## +     df, subset = MemberSince >= 1)
## 
## > m2_2_PL <- lm(paste0("Reason_opinions ~ L.RO", iv2_PL, 
## +     controls), df, subset = MemberSince >= 1)
## 
## > m2_3 <- lm(paste0("referrals_to_court ~ L.RC ", iv2, 
## +     controls), df, subset = MemberSince >= 1)
## 
## > m2_3_PL <- lm(paste0("referrals_to_court ~ L.RC ", 
## +     iv2_PL, controls), df, subset = MemberSince >= 1)
## 
## > texreg::texreg(list(m0_1, m0_2, m0_3), stars = c(0.1, 
## +     0.05, 0.01), file = "tables/Table_10_1.tex", custom.coef.names = c(NA, 
## +     "LDV", "P ..." ... [TRUNCATED]
## The table was written to the file 'tables/Table_10_1.tex'.
## 
## > texreg::texreg(list(m1_1, m1_2, m1_3), stars = c(0.1, 
## +     0.05, 0.01), file = "tables/Table_10_2.tex", custom.coef.names = c(NA, 
## +     "LDV", "G ..." ... [TRUNCATED]
## The table was written to the file 'tables/Table_10_2.tex'.
## 
## > texreg::texreg(list(m2_1, m2_1_PL, m2_2, m2_2_PL, 
## +     m2_3, m2_3_PL), stars = c(0.1, 0.05, 0.01), file = "tables/Table_10_3.tex", 
## +     custom.c .... [TRUNCATED]
## The table was written to the file 'tables/Table_10_3.tex'.
run_stop <- Sys.time()
run_time <- (run_stop - run_start)
run_time
## Time difference of 0.2113831 secs

6 Regression analysis creating Table A10.1 and Figure 10.2 based on the CHES data

The script analyses_ches in the subfolder rcode creates Table_A10_1.tex in the tables folder and Figure_10_2 in the figures folder.

run_start <- Sys.time()

source("rcode/analyses_ches.R", echo = T)
## 
## > ches <- readRDS("data/data_ches.rds")
## 
## > controls <- " + year +  west + govt +"
## 
## > ivs <- "~ populism  * lrgen + populism * I(lrgen^2) "
## 
## > m_position <- lme4::lmer(formula(paste0("EU_position", 
## +     ivs, controls, "(1|country)")), data = ches)
## 
## > summary(m_position)
## Linear mixed model fit by REML ['lmerMod']
## Formula: EU_position ~ populism * lrgen + populism * I(lrgen^2) + year +  
##     west + govt + (1 | country)
##    Data: ches
## 
## REML criterion at convergence: 2775.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3405 -0.6116  0.0745  0.6619  2.4867 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  country  (Intercept) 0.116    0.3405  
##  Residual             1.063    1.0310  
## Number of obs: 931, groups:  country, 28
## 
## Fixed effects:
##                      Estimate Std. Error t value
## (Intercept)         -7.512026  13.098686  -0.573
## populism             1.151588   0.482663   2.386
## lrgen                1.792957   0.078650  22.797
## I(lrgen^2)          -0.172048   0.007885 -21.820
## year                 0.004757   0.006514   0.730
## westWest            -0.340240   0.153923  -2.210
## govtOpposition      -0.602409   0.075521  -7.977
## populism:lrgen      -1.146758   0.194545  -5.895
## populism:I(lrgen^2)  0.095422   0.017363   5.496
## 
## Correlation of Fixed Effects:
##             (Intr) poplsm lrgen  I(l^2) year   wstWst gvtOpp pplsm:
## populism    -0.031                                                 
## lrgen       -0.069  0.311                                          
## I(lrgen^2)   0.064 -0.278 -0.973                                   
## year        -1.000  0.026  0.056 -0.052                            
## westWest    -0.107 -0.032  0.044 -0.030  0.099                     
## govtOppostn -0.037 -0.021  0.198 -0.172  0.031 -0.011              
## poplsm:lrgn  0.048 -0.912 -0.368  0.360 -0.044  0.049  0.003       
## pplsm:I(^2) -0.049  0.816  0.406 -0.423  0.044 -0.054 -0.004 -0.976
## 
## > fit.effR <- effects::effect("populism*lrgen", m_position, 
## +     xlevels = list(populism = seq(0, 1, length.out = 2), lrgen = seq(1, 
## +         10,  .... [TRUNCATED] 
## 
## > PredPropR <- data.frame(fit.effR$model.matrix, fit.effR$fit, 
## +     fit.effR$lower, fit.effR$upper)
## 
## > p_position <- ggplot(PredPropR, aes(x = lrgen, y = fit.effR.fit)) + 
## +     geom_ribbon(aes(ymax = fit.effR.upper, ymin = fit.effR.lower, 
## +          .... [TRUNCATED] 
## 
## > p_position
## 
## > ggsave("figures/Figure_10_2.pdf", width = 16, height = 9, 
## +     units = "cm")
## 
## > ggsave("figures/Figure_10_2.png", width = 16, height = 9, 
## +     units = "cm")
## 
## > texreg::texreg(m_position, file = "tables/Table_A10_1.tex", 
## +     stars = c(0.1, 0.05, 0.01), custom.model.names = "Support for European Integratio ..." ... [TRUNCATED]
## The table was written to the file 'tables/Table_A10_1.tex'.

run_stop <- Sys.time()
run_time <- (run_stop - run_start)
run_time
## Time difference of 0.4594879 secs

7 Session Info

This notebook was run using the following setup:

pander::pander(sessionInfo())

R version 4.4.0 (2024-04-24 ucrt)

Platform: x86_64-w64-mingw32/x64

locale: LC_COLLATE=German_Austria.utf8, LC_CTYPE=German_Austria.utf8, LC_MONETARY=German_Austria.utf8, LC_NUMERIC=C and LC_TIME=German_Austria.utf8

attached base packages: stats, graphics, grDevices, utils, datasets, methods and base

other attached packages: ggthemes(v.5.1.0), effects(v.4.2-2), carData(v.3.0-5), lubridate(v.1.9.3), forcats(v.1.0.0), stringr(v.1.5.1), dplyr(v.1.1.4), purrr(v.1.0.2), readr(v.2.1.5), tidyr(v.1.3.1), tibble(v.3.2.1), ggplot2(v.3.5.1) and tidyverse(v.2.0.0)

loaded via a namespace (and not attached): gtable(v.0.3.5), xfun(v.0.43), bslib(v.0.7.0), insight(v.0.19.11), lattice(v.0.22-6), tzdb(v.0.4.0), vctrs(v.0.6.5), tools(v.4.4.0), generics(v.0.1.3), fansi(v.1.0.6), highr(v.0.10), pkgconfig(v.2.0.3), Matrix(v.1.7-0), lifecycle(v.1.0.4), compiler(v.4.4.0), farver(v.2.1.2), textshaping(v.0.3.7), munsell(v.0.5.1), mitools(v.2.4), survey(v.4.4-2), htmltools(v.0.5.8.1), sass(v.0.4.9), yaml(v.2.3.8), pillar(v.1.9.0), nloptr(v.2.0.3), jquerylib(v.0.1.4), MASS(v.7.3-60.2), cachem(v.1.0.8), boot(v.1.3-30), nlme(v.3.1-164), tidyselect(v.1.2.1), digest(v.0.6.35), stringi(v.1.8.4), pander(v.0.6.5), bookdown(v.0.39), labeling(v.0.4.3), rmdformats(v.1.0.4), splines(v.4.4.0), rprojroot(v.2.0.4), fastmap(v.1.1.1), grid(v.4.4.0), here(v.1.0.1), colorspace(v.2.1-0), cli(v.3.6.2), magrittr(v.2.0.3), survival(v.3.5-8), utf8(v.1.2.4), withr(v.3.0.0), scales(v.1.3.0), estimability(v.1.5.1), timechange(v.0.3.0), httr(v.1.4.7), rmarkdown(v.2.26), nnet(v.7.3-19), lme4(v.1.1-35.3), ragg(v.1.3.1), hms(v.1.1.3), evaluate(v.0.23), knitr(v.1.46), rlang(v.1.1.3), Rcpp(v.1.0.12), glue(v.1.7.0), DBI(v.1.2.2), rstudioapi(v.0.16.0), minqa(v.1.2.6), jsonlite(v.1.8.8), R6(v.2.5.1), texreg(v.1.39.3) and systemfonts(v.1.0.6)

run_stop_total <- Sys.time()
run_time_total <- (run_stop_total - run_start_total)
run_time_total
## Time difference of 8.305425 secs